#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N=2e5+10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
int n;
ll a[N];
void solve()
{
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];

	sort(a+1,a+1+n);
	
	int pos1=2,pos2=n,sz1=2,sz2=1;
	ll sum1=a[1]+a[2],sum2=a[n];
	while(pos1+1<pos2)
	{
		if(sum1>=sum2)
		{
			pos2--;
			sum2+=a[pos2];
			sz2++;
		}
		if(sz1<=sz2)
		{
			pos1++;
			sum1+=a[pos1];
			sz1++;
		}
		if(sz1>sz2&&sum1<sum2)
		{
			cout<<"YES"<<'\n';
			return;
		}
	}
	if(sz1>sz2&&sum1<sum2)
	{
		cout<<"YES"<<'\n';
		return;
	}
	cout<<"NO"<<'\n';


	
}

int main()
{
	close();
	int T; cin>>T;
	while (T--) solve();
	return 0;
}